Repository navigation
feat(android): [Part 4] Prefer Activity ui.load transactions over Nav3 transactions - #6484
Merged
0xadam-brown merged 4 commits intoNov 13, 2026
Conversation
This was referenced Nov 6, 2026
Contributor
|
📲 Install BuildsAndroid
|
0xadam-brown
marked this pull request as ready for review
November 6, 2026 12:32
0xadam-brown
requested review from
markushi and
runningcode
and removed request for
a team
November 6, 2026 12:32
runningcode
reviewed
Nov 11, 2026
0xadam-brown
force-pushed
the
fix/nav3-lifecycle-3-lease-withdrawal
branch
from
November 11, 2026 11:21
274e94e to
6460391
Compare
0xadam-brown
force-pushed
the
feat/nav3-lifecycle-4-ui-load-preference
branch
from
November 11, 2026 11:21
e8905ea to
9ea9424
Compare
0xadam-brown
force-pushed
the
fix/nav3-lifecycle-3-lease-withdrawal
branch
from
November 11, 2026 12:17
6460391 to
3b26f99
Compare
0xadam-brown
force-pushed
the
feat/nav3-lifecycle-4-ui-load-preference
branch
2 times, most recently
from
November 11, 2026 12:28
bb73582 to
688b4a7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 688b4a7. Configure here.
runningcode
approved these changes
Nov 11, 2026
runningcode
left a comment
Contributor
There was a problem hiding this comment.
Looks good with 1 comment for you to look at!
0xadam-brown
force-pushed
the
fix/nav3-lifecycle-3-lease-withdrawal
branch
from
November 12, 2026 09:31
3b26f99 to
0469993
Compare
0xadam-brown
force-pushed
the
feat/nav3-lifecycle-4-ui-load-preference
branch
3 times, most recently
from
November 13, 2026 06:59
510a428 to
65aca7a
Compare
Base automatically changed from
fix/nav3-lifecycle-3-lease-withdrawal
to
feat/nav3-lifecycle
November 13, 2026 07:25
…nsactions The Nav3 lease is now also withdrawn when an Activity is created over the leaseholder, not only when it resumes. On API 29+, creation is reported from onActivityPreCreated, before ActivityLifecycleIntegration binds the new Activity's ui.load transaction, so the leaseholder's nav transaction no longer holds the scope's transaction slot and ui.load binds, as with Nav2. Errors and spans from the new Activity's onCreate and onStart are no longer attributed to the leaseholder on any API level. Because ui.load now binds, returning quickly to a nav root while the closed Activity's ui.load is still running would leave the nav root's transaction blocked. The coordinator therefore retries binding the leaseholder's nav transaction once when another Activity is destroyed, within 10s of the blocked attempt. Below API 29, there's no onActivityPreCreated, so the new Activity's ui.load stays unbound as before; this is documented in the package README.
Hold a candidate's host Activity weakly so a candidate that fails to unregister can't keep a destroyed Activity alive, replace the resumedOnly flag with a minimumState parameter, and tidy the README footnotes.
The window for retrying a nav transaction blocked by an Activity's ui.load transaction was measured by subtracting SentryDates from options.dateProvider. That clock is replaceable, falls back to wall-clock time unless both dates carry a nanoTime, and doesn't count while an Android device suspends. Record an io.sentry.time.Deadline when the publication is blocked instead, on the ticker from options.getMonotonicTicker(), which StagedNavTransaction now takes as a constructor parameter so tests can drive it with TestMonotonicTicker. A retry exactly at the end of the 10-second window no longer qualifies.
0xadam-brown
force-pushed
the
feat/nav3-lifecycle-4-ui-load-preference
branch
from
November 13, 2026 07:27
65aca7a to
9061702
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Stack (Nav3 Lifecycle)
📜 Description
When the user opens an Activity from a Nav3 root, that Activity's
ui.loadtransaction is now bound to the scope instead of being blocked by the Nav3 root's nav transaction (API 29+), matching Nav2. A Nav3 transaction blocked by a closing Activity'sui.loadis retried once.ui.loadtransaction†ui.loadbinds in preference to the nav transaction, as it does with Nav2How this PR fixes things
This PR withdraws the lease when a covering Activity is created. On API 29+ this happens in
onActivityPreCreated, which runs beforeActivityLifecycleIntegrationtries to bindui.load, thereby allowing theui.loadtransaction to beat out the nav transaction.Below API 29 there's no
onActivityPreCreated, so creation is reported fromonActivityCreated, meaning the nav transaction beats out theui.loadtransaction.Known gaps
Documented in the package README.
ui.actiontransaction from the gesture that caused the return can still block the nav transaction.ui.load.Addressing the last two would require updating
ActivityLifecycleIntegrationto unbind a finishing Activity'sui.loadwhen it pauses. That'd change behavior for every app and not just users of Nav3, so I haven't included it here. We could follow-up at some point if we care to. Nicely, tackling things in ActivityLifecycleIntegration would have the happy side effect of simplifying the heuristics we have to use here.💡 Motivation and Context
Nav2 lets an Activity's
ui.loadtransaction take precedence, but Nav3 blocked it whenever the Activity was opened from a Nav3 root, so the Activity's auto-instrumented spans went elsewhere. Withdrawing the lease only on resume (#6483) also left the covering Activity'sonCreate/onStartwork attributed to the previous root.addresses: JAVA-785
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Last PR in the stack. Once the stack is merged into the collection branch, squash-merge #6480 into
main.